package com.xlh.dto.course;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.xlh.dto.cases.BusinessDTO;
import com.xlh.pojo.course.SkillNotes;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

/**
 * 课程首页
 * <p>
 * Created by lx on 2019/1/25.
 */
@Data
public class CourseIndexDTO extends CourseIndexDataDTO {

    @ApiModelProperty(value = "当前时间(早安、午安)")
    private String timeStr;

    @ApiModelProperty(value = "教师的姓名")
    private String userName;

    @ApiModelProperty(value = "学生-正在学习课程数量")
    private Integer studiedCourseNum = 0;

    @ApiModelProperty(value = "学生-实验总时长")
    private String experimentTime = "";

    @ApiModelProperty(value = "学生-已提交作业数量")
    private Long submittedExercisesNum = 0L;

    @ApiModelProperty(value = "学生-已提交报告数量")
    private Long submittedReportNum = 0L;

    @ApiModelProperty(value = "教师-当前教授班级")
    private StatisticsDTO classes = new StatisticsDTO(0L, null, null);

    @ApiModelProperty(value = "教师-待审批随堂练习")
    private StatisticsDTO unreviewedPractice = new StatisticsDTO(0L, null, null);

    @ApiModelProperty(value = "教师-待审批实验报告")
    private StatisticsDTO unreviewedReport = new StatisticsDTO(0L, null, null);

    @ApiModelProperty(value = "教师-待审批试卷")
    private StatisticsDTO unreviewedTestPaper = new StatisticsDTO(0L, null, null);

    @ApiModelProperty(value = "专业方向")
    private List<DirectionDataDTO> directions;

    @ApiModelProperty(value = "技术")
    private List<List<TechnologyDTO>> technologies;

    @ApiModelProperty(value = "行业案例")
    private List<List<BusinessDTO>> businessCase;

    @ApiModelProperty(value = "岗位")
    private List<List<SkillNotes>> skills;

    @ApiModelProperty(value = "是否请求课程")
    private Boolean requestCourse = false;

    public String getTimeStr() {
        return DateTime.of(DateUtil.date()).isAM() ? "早安" : "午安";
    }

    public Integer getStudiedCourseNum() {
        return studiedCourseNum == null ? 0 : studiedCourseNum;
    }

    public Long getSubmittedExercisesNum() {
        return submittedExercisesNum == null ? 0L : submittedExercisesNum;
    }

    public Long getSubmittedReportNum() {
        return submittedReportNum == null ? 0L : submittedReportNum;
    }

    public StatisticsDTO getUnreviewedPractice() {
        if (unreviewedPractice == null || unreviewedPractice.getCount() == null) {
            return new StatisticsDTO(0L, null, null);
        }
        return unreviewedPractice;
    }

    public StatisticsDTO getUnreviewedReport() {
        if (unreviewedReport == null || unreviewedReport.getCount() == null) {
            return new StatisticsDTO(0L, null, null);
        }
        return unreviewedReport;
    }

    public StatisticsDTO getUnreviewedTestPaper() {
        if (unreviewedTestPaper == null || unreviewedTestPaper.getCount() == null) {
            return new StatisticsDTO(0L, null, null);
        }
        return unreviewedTestPaper;
    }

    public StatisticsDTO getClasses() {
        if (classes == null || classes.getCount() == null) {
            return new StatisticsDTO(0L, null, null);
        }
        return classes;
    }
}



